/**
 * 내용 1. 데이터 송수신
 * 		2. 조건 분기 처리
 */

package jong;

import java.io.*;
import java.net.*;

public class MultiChatClientThread extends Thread {
	Socket socket = null;
	MultiChatClient mcc = null;
	boolean tFlag = false;
	
	ObjectOutputStream send = null;
	ObjectInputStream receive = null;
	
	public MultiChatClientThread(MultiChatClient mcc, Socket socket){
		this.mcc = mcc;
		this.socket = socket;
	}
	
	public void run(){
		try{
			send = new ObjectOutputStream(socket.getOutputStream());
			receive = new ObjectInputStream(socket.getInputStream());
			
			SocketData sd = new SocketData("login", mcc.ID.getText(), mcc.message.getText(), null);
			
			send.writeObject(sd);
			
			tFlag = true;
			while(tFlag){
				sd = (SocketData)receive.readObject();
				mcc.dataSet(sd);
			}
		}catch(Exception ex){
			ex.getMessage();
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
}
